Abstract
In this blog-post I will review as objectively as possible my first Shiny app named Covid-Explorer. The first section of the blog offers an introduction to how the app functions and and its potentia usage. In the Self Review section of the blog I will endeavor to evaluate the result of my work, as well as, offer points of improvement that might take place in the short furure.As the name suggests the purpose of Covid Analytics is to offer a summary of key data related to COVID-19. As so, in the app the user can find a broad spectrum of data and figures associated with the impact of COVID-19 in a plethora of countries. The app is structured based on a navigation bar at the top of the page, from which users can select to explore different panels.
It is important to state that the main advantage of deploying a Shiny app is not only the option of providing the user with the ability to interactively explore the data, but also and most importantly that the data themselves are updated daily allowing for the user to constantly re-use the app to form new conclusions.
Briefly, the app consists of the following sections:
A. Cases by Country: Includes a Choropleth map in which countries are shaded in proportion to the total cases of COVID-19 in that country. Also, the panel cosists of two Tables that provide statistics related to COVID-19 on both global and country level. The former table is interactive, allowing users to search for their country of choice. Finally, in the bottom of the panel you can find two interactive figures that visualize the growth in cases of COVID-19 and the death rate of the virus over time by country.
B. Apple Analytics: Select a country from the select input option and explore data from Apple Mobility Trend Reports for various cities in the world to reveal interesting citizen movement patterns for driving, walking and transit.
C. Google Analytics: Select a country from the select input option and explore data from Google Mobility Trend Reports for various countries to reveal changes in visits to places compared to a baseline period before the pandemic.
D. Measures: Two interactive figures can be found in this tab. Both of them track measures taken by governments to prevent the spread of COVID-19. The first figure tracks the number of measures authorities have taken by country across five different categories over time. The second figure provides extensive details about the measures and their implementation. Note that in order to access the second figure you need to click on the legend of the first one in order to select the category of your interest.
E. Tweets: This tab is a working project so it is not finalized yet. However, you can still select a hastag and search Twitter for the latest 100 tweets. Also, plots illustrating a sentiment analysis are included.
F. About: Current tab, with instruction on how to run the app and details of the creator.
G. Authenticate Twitter Account: Instructions about how to set up a Twitter account and get access to your personal and private key.
After establishing the structure of the app and summarizing its contents, it’s essential to further expand on what the possible usage of its individual sections might be. At this point it’s important to clarify that, when creating this app the targeted audience I had in mind was citizens that would like to get
informed about the spread of the virus in their countries. However, as the development of the app progressed and I gained access to supplementary data, I decided to incorporate additional sections that offer valuable insight to both government and business executives.
Holding that thought I will clarify how audiences from both groups shall experiment with the app to reach informative conclusions.
The Cases by Country and Measures tabs are primarily aimed to be used by the broad public. Hence, instead of bombarding the user with complex figures and tables, the initial visualization she lays eyes on when opening the app is a world map, with countries colored according to the number of COVID-19 cases. This, elementary figure can be easily interpreted and allows the user to rapidly understand which countries have been mostly impacted by the virus. The Worldwide Statistics table offers a summary of key variables to measure how severely the pandemic is progressing on a global scale. Finally, users have the option to search for their country of interest. They can do so by either searching for their
country at the Aggregated data per country table or by using the select input found at the bottom of the panel that produces a Daily Change in Cases by Category figure and the associated Death Rate figure of the selected country.
Now that the user, gained the necessary insight about the progress of cases in her country, she might be interested in gaining information about new measures being implemented in her country of interest. To resolve this I developed the Measures panel in which users can quickly get up to date with new measures being implemented. Based on the first figure the user can visually understand how many measures the country’s authorities have taken and also at which areas they are targeting their policies. This, knowledge can be essential to form an opinion regarding how effective the government of the country has been in contaminating the spread of the virus. Finally, when user clicks on one of the categories at the legend of the first graph a second figure named Occurence of Measures by Category pops-up providing additional information on the specific measures being implemented at the moment. Solely, by looking at the second graph the user gets all information, about what measures she is expected to follow in a matter of seconds, instead of having to browse various websites or watching the news. Moreover, for citizens of countires that are allowed to flight to other countries this figure provides all the necessary information for what documents they are expected to provide at the airport and at what measures they should adhere to.
The following panels, although they may be appealing to the broad public, the targeted audience is government and business executives.
The Apple Analytics and Google Analytics figures can offer valuable insight when being looked at either from a business or governmental perspective. By identifying, citizen movement patterns for driving, walking and transit and tracking changes in visits to common places, such as grocery stores, workplaces, parks and transit stations compared to a baseline period before the pandemic, governmental authorities can evaluate the effectiveness of their taken measures and either continue their implementation or sufficiently adjust them to ensure the safety of the citizens.
It’s important to mention that all data are anonymous, so none of the governments has access to personal information, but at the same time, they can gain an insight about the general population in different geographic segments of their countries.
Furthermore, this trends in the behavior of the population can signify key drivers of change in several business industries. Corporations, can model and predict, not only how their targeted consumers are expected to behave, but also, based on the indications provided in the graphs, identify what their consumers would need to adjust to this new reality.
For the same reasons mentioned above I developed the Twitter sentiment analysis, to model how populations react to new measures and how resilient or intolerant are towards them. However, since this panel is still under construction and at this point the tweets being scraped are only the latest 100, I won’t further elaborate on the potential usage of this panel. Nevertheless, in the next section of this blog, I will comment on what the upcoming improvements would be.
Finally, please bare in mind that the app was created as part of an assignment for unit ETC5523: Communicating with Data; a core unit in the master of Business Analytics at Monash University. The purpose of the assignment was to develop a Shiny app, as so all data and conclusions found in the app should be treated with cautious. The packages containing all data used in this app come from the following packages: (Krispin and Byrnes 2020a), (Krispin and Byrnes 2020b), (Guidotti and Ardia 2020)
In this section of the blog I will try to review as fairly as possible my work.
When I consider my app I think that I am mostly proud for the Measures panel. The reason is that I find it extremely useful, as I found myself referring to it to get up to date with new measures being implemented. During the mid-semester break I went to the Netherlands and when I was about to return to Greece, where I am currently studying my master’s online, I wasn’t quite sure which documents I was required to provide at the boarder. Luckily, a quick look at the Occurence of Measures by Category figure provided all that information for me.
From a “coding” perspective, I have to say that the process of developing the app helped me a lot in acquiring new knowledge, especially on how reactive programming works and how to use it.
Another valuable skill I acquired was to consider how easily a user could understand the structure and the functionality of the app. To do this, I iterated between different layouts and after taking into consideration some feedback, I decided to proceed with a very simple layout, mainly using a side-bar and a main-panel as I found that users found that layout more convenient.
Moreover, since the app was completely my own idea and work it was the first time that I made a more serious effort to include CSS to further stylish it. I experimented with gradient background-coloring, creating tags for my tables and headers to have their own styling, changing the appearance of the navigation bar and of the slider inputs.
Finally, I enjoyed that the final result was a fucntioning app that I proudly uploaded to the shiny server.
To summarise, the process of developing a Shiny app helped me with understanding how to create interactive visualizations to answer world-related problems, to take into consideration the targeted audience in the development stages of the app, how to take advantage of reactive programming to update your code and I can finally say that I am now confident in using CSS in my projects.
Moving on to what I could have done better or to what I can improve. The list can end up being quite extensive, but I will try to point out the most important aspects. Not, because I don’t want to criticize my work, but because my tutors are currently in the process of marking it and for sure I don’t want to make their task easier in identifying my mistakes. Jokes aside, I consider the following areas that require improvement or adjustments.
Turn code into functions, while I was writing the code for the server of the app, I realized that the code used to produce the outputs was very similar. For example, in the majority of the figures the user inputs a country of choice, as so the first part of the code in the server would be to filter based on that country. Although I did that, I ended up repeating myself, and constantly filtering my dataset in all parts of the code. To avoid that I could have included a reactive function inside the server to update the dataset based on the user input and then pass the updated dataset into the server outputs to produce the figures. The reason I didn’t do that was because while I creating the up I made the decision to produce the outputs even with “ugly” code in order to focus my energy on brainstorming ideas and in the back of head I had the impression that after the app is finished I would “beautify” my code to be faster, more efficient and to avoid duplication. In case you ask Why I didn’t do that I would argue that the deadline was approaching fast, but the main reason was that I couldn’t understand myself. Although, it might sound harsh for an app that’s working fine, but I have to be honest that while I was writing the code I was so excited with the production aspect, that I didn’t used any comments to write down what I am doing in the particular parts of both the cleaning script and the server. The result, was a script that was using the same datasets but with different names that took me a long time to debug and try to understand which parts I should drop or keep. Without a doubt my workflow won’t be the same after this assignment.
Moreover, regarding the type of output I could improve, the Twitter panel requires the most work. Fist of all, I have to figure out why the particular panel, although, fully functions at my local device, it’s not working accurately on the Shiny server. I thought, that the problem was regarding the consumer and private keys obtained from Twitter, but the datatable with the most recent tweets gets displayed on the app, but the same doesn’t hold for the remaining figures.
Another area of improvement is how aestheticaly pleasing is the final result.
Finally, the thing that annoys me mostly is that ever since I uploaded the app to the shiny server it hurts to see spelling mistakes.
A datatable than can be filtered according to Date and Country and showcase the daily cases.
A map that can be filtered by country and show where citizens from that country can fly to.
A sentiment analysis of Twitter data, using timestamps. The idea is to create an index of tolerance to new measures to indicate which countries have been fatigued the most by the actions of their governments. The idea was/is to web scrape tweets on dates that new measures were announced for a country from the beginning of the pandemic until now. Then, doing a sentiment analysis of that data to realize whats the public opinion towards the new measures and if that opinion is in parallel with the progress of cases in that country.
Overall, I found the experience of developing an app quite fan and rewarding, although sometimes frustrating. I would like to also get back some feedback from anyone who happens to read this blogpsot. Try out my app here and please feel free to share any thoughts. Moreover, if you find the app interesting enough or you would like to work together on a project don’t hesitate to contact me.
Or as, Glootie from the popular show Rick and Morty would say:
The following packages contain all data used in the app.
Guidotti, Emanuele, and David Ardia. 2020. “COVID-19 Data Hub.” Journal of Open Source Software 5 (51): 2376. https://doi.org/10.21105/joss.02376.
———. 2020b. Coronavirus: The 2019 Novel Coronavirus Covid-19 (2019-nCoV) Dataset. https://github.com/RamiKrispin/coronavirus.